package com.saicmotor.workmanager;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;

/**
 * @Author xinxinzhang
 * @Date 2022/08/18
 **/
public class UploadWorker extends Worker {
    // 任务
    public UploadWorker(
            @NonNull Context context,
            @NonNull WorkerParameters params) {
        super(context, params);
    }

    @Override
    public Result doWork() {
        // 接收输入数据
        String uri = getInputData().getString("IMAGE_URI");
        if(uri == null) {
            return Result.failure();
        }

        uploadImages();
        return Result.success();
    }

    private void uploadImages(){
        // 具体任务...

    }
}
